import { INCREAMENT, DECREAMENT } from '../constant'

const intState = 0
const countReducer = (preState = intState, action) => {
  const { type, data } = action
  switch (type) {
    case INCREAMENT:
      return preState + data;
    case DECREAMENT:
      return preState - data;
    default:
      return preState
  }
}
export default countReducer